package com.buddies.lottery.ui.lottery.history;

import com.buddies.lottery.R;
import com.buddies.lottery.data.bean.LotteryReward;
import com.buddies.lottery.utils.DateUtils;
import com.buddies.lottery.utils.LotteryUtils;
import com.buddies.lottery.widget.DotView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

public class LotteryHistoryAdapter extends BaseQuickAdapter<LotteryReward, BaseViewHolder> {

    public LotteryHistoryAdapter(List<LotteryReward> data) {
        super(R.layout.item_lottery_history, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, LotteryReward item) {
        helper.setText(R.id.tv_period, LotteryUtils.formatLotteryPeriod(item.period));
        helper.setText(R.id.tv_time, DateUtils.format(item.open_time * 1000));
        ((DotView) helper.getView(R.id.tv_win_num)).setDots(item.getWinNum());
        ((DotView) helper.getView(R.id.tv_win_num_annotation)).setDots(item.getWinNumAnnotation());
    }

}
